package org.example.Thread01;

public class Dome_Thread01 {
    public static void main(String[] args) throws InterruptedException {
        MyThread myThread=new MyThread();
        myThread.start();
        while(true){
            Thread.sleep(1000);
            System.out.println("Main Hello Thread...");
        }
    }
}
//自定义一个线程类，继承JDK中的Thread类
class MyThread extends Thread{
    //定义线程的任务
    @Override
    public void run() {
        while(true){
            try{
                Thread.sleep(1000);
            }catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("My Hello Thread...");
        }
    }
}
